package com.lin.session.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @作者: 林江
 * @创建时间: 2024/2/15
 * @功能:
 */
@RestController
public class SessionTestController {

    @RequestMapping("/setV")
    public String setAttribute(HttpSession session) {
        session.setAttribute("name", "林江");
        return "success";
    }

    @RequestMapping("/getV")
    public String getAttribute(HttpSession session) {
        Object name = session.getAttribute("name");
        return "success --> " + name;
    }
}
